<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>Colors</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
</style>
<script language="JavaScript" type="text/javascript">
	// Dojo configuration
	djConfig = { 
		isDebug: true
	};
</script>
<script language="JavaScript" type="text/javascript" src="../../dojo.js"></script>
<script language="JavaScript" type="text/javascript">
dojo.require("dojo.graphics.color");
dojo.require("dojo.graphics.color.hsv");
dojo.require("dojo.graphics.color.hsl");

var c = dojo.graphics.color;
var hex = ["#003399", "#039", "003399", "039"];
for(var i = 0; i < hex.length; i++) {
	var rgb = c.hex2rgb(hex[i]);
	dojo.debug(hex[i], "-> hex2rgb ->", rgb, "-> rgb2hex ->", c.rgb2hex(rgb));
	dojo.debug("extractRGB(" + hex[i] + ")", c.extractRGB(hex[i]));
}

dojo.debug();
dojo.debug("Color object:");
var color = new dojo.graphics.color.Color("ffc");
dojo.debug("toRgb:", color.toRgb());
dojo.debug("toHex:", color.toHex());
dojo.debug("toCss:", color.toCss());
dojo.debug("toString:", color.toString());
dojo.debug("toHsv:", color.toHsv());
dojo.debug("toHsl:", color.toHsl());

dojo.debug();
dojo.debug("Named colors:");
for(var clr in c.named) {
	var rgb = c.extractRGB(clr);
	dojo.debug(clr, "->", rgb, "->", c.rgb2hex(rgb));
}


dojo.debug();
dojo.debug("Color spaces:");

var a = [255,255,204];
var b = dojo.graphics.color.rgb2hsv(a);
var c = dojo.graphics.color.hsv2rgb(b);
dojo.debug("HSV:", a, "->", b, "->", c);

var d = [255,255,204];
var e = dojo.graphics.color.rgb2hsl(d);
var f = dojo.graphics.color.hsl2rgb(e);
dojo.debug("HSL:", d, "->", e, "->", f);


dojo.debug();
dojo.debug("String handling:");

dojo.debug('Hex from rgb(100,100,100): ' + new dojo.graphics.color.Color('rgb(100,100,100)').toHex());
dojo.debug('Hex from rgb(255,0,128): ' + new dojo.graphics.color.Color('rgb(255,0,128)').toHex());

</script>
</head>
<body>
	Tests happened in head. This should be moved to a JS-only file.
</body>
</html>

